package cn.wolfcode.shop.cloud.util;

import org.apache.commons.codec.digest.DigestUtils;

import java.util.UUID;


public class MD5Util {

    /**
     *
     * @param password 明文密码
     * @param salt  盐
     * @return  密文密码
     */
    public static String encode(String password,String salt){
        String pass = "" + salt.charAt(0)+salt.charAt(2)+password+salt.charAt(4)+salt.charAt(3);
        return DigestUtils.md5Hex(pass);
    }

    public static void main(String[] args) {
        String salt = UUID.randomUUID().toString().replace("-","").substring(0,6);
        System.out.println(salt);
        System.out.println(encode("111111", salt));
        /*String encodepass = encode("111111",salt);
        System.out.println("salt=" + salt);
        System.out.println(encodepass);*/
    }
}
